//
//  RecomCollectionViewCell.m
//  Cat
//
//  Created by lushitong on 2018/12/21.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "RecomCollectionViewCell.h"

@interface RecomCollectionViewCell()

@property (nonatomic, strong) UIView *operView;
@property (nonatomic, strong) UIView *lineView;
@property (nonatomic, strong) UIView *rightLineView;
@property (nonatomic, strong) UIView *bottomView;

@end

@implementation RecomCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
	if (self = [super initWithFrame:frame]) {
		[self loadSubviews];
	}
	return self;
}

- (void)loadSubviews {
	[self.contentView addSubview:self.operView];
	[self.operView addSubviews:@[self.lineView,self.rightLineView]];
	
	[self.operView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.left.equalTo(self.contentView.mas_left).offset(kQKFitModuleDecimal(16.0));
		make.right.equalTo(self.contentView.mas_right).offset(-kQKFitModuleDecimal(16.0));
		make.top.equalTo(self.contentView.mas_top);
		make.bottom.equalTo(self.contentView.mas_bottom).offset(-kQKFitModuleDecimal(16));
	}];
	
	[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.top.equalTo(self.operView.mas_top);
		make.bottom.equalTo(self.operView.mas_bottom);
		make.centerX.equalTo(self.contentView.mas_centerX);
		make.width.equalTo(@(kQKFitModuleDecimal(1.0)));
	}];
	
	[self.rightLineView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.left.equalTo(self.lineView.mas_right);
		make.height.equalTo(@(kQKFitModuleDecimal(1.0)));
		make.right.equalTo(self.operView.mas_right);
		make.centerY.equalTo(self.lineView.mas_centerY);
	}];

}

#pragma mark----- lazy init -----

- (UIView *)operView {
	if (!_operView) {
		_operView = [[UIView alloc] init];
		_operView.backgroundColor = [UIColor whiteColor];
		_operView.layer.cornerRadius = kQKFitModuleDecimal(6.0);
		_operView.layer.masksToBounds = YES;
	}
	return _operView;
}

- (UIView *)lineView {
	if (!_lineView) {
		_lineView = [[UIView alloc] init];
		_lineView.backgroundColor = COLOR_WITH_HEX(0xD4D4D4);
	}
	return _lineView;
}

- (UIView *)rightLineView {
	if (!_rightLineView) {
		_rightLineView = [[UIView alloc] init];
		_rightLineView.backgroundColor = COLOR_WITH_HEX(0xD4D4D4);
	}
	return _rightLineView;
}

@end
